// #include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sources/logger.hpp>
#include <boost/log/attributes/timer.hpp>
#include <boost/log/utility/setup.hpp>
#include <boost/log/support/date_time.hpp>
namespace logging = boost::log;
namespace expr = boost::log::expressions;

int main()
{
    // 添加常见的日志属性，如时间戳和线程ID
    logging::add_common_attributes();

    // 设置日志格式
    logging::formatter fmt = expr::stream
                             << "[" << expr::format_date_time<boost::posix_time::ptime>("TimeStamp", "%Y-%m-%d %H:%M:%S.%f") // 修改这行
                             << "] [" << expr::attr<logging::attributes::current_thread_id::value_type>("ThreadID")
                             << "] [" << logging::trivial::severity
                             << "] " << expr::smessage;
    // 将格式应用到控制台日志
    logging::add_console_log(std::clog, boost::log::keywords::format = fmt);

    // 将日志消息写入文件
    logging::add_file_log("im.log", boost::log::keywords::format = fmt);

    BOOST_LOG_TRIVIAL(trace) << "This is a trace severity message";
    BOOST_LOG_TRIVIAL(debug) << "This is a debug severity message";
    BOOST_LOG_TRIVIAL(info) << "This is an informational severity message";

    return 0;
}